﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Root.master" AutoEventWireup="true" CodeFile="servises.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="Server">
    <script src="../Scripts/toolbar.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        // <![CDATA[

        function onMenuClick(s, e) {
            switch (e.item.index) {
                case 3:
                    grdServise.GetRowValues(grdServise.GetFocusedRowIndex(), 'STATE', onComplete);
                    break;
                case 4:
                    e.item.NavigateUrl = '~/rep/orderRep.aspx?code=' + grdServise.GetEditValue('CODE');
                    break;
                default: MenuItemClick(e, grdServise);
            }
        }
        // ]]>
    </script>
    <div class="pageLabel">
        <dx:ASPxLabel ID="lbl_page" runat="server" Text="Услуги" Font-Size="Medium" Theme="iOS">
        </dx:ASPxLabel>
    </div>
    <div style="float: left; margin-left: 10px; margin-right: 10px;">
        <dx:ASPxMenu ID="mMenu" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
            SeparatorHeight="15px" ItemSpacing="1px">
            <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
            <ClientSideEvents ItemClick="function(s, e) { onMenuClick(s, e); }" />
            <Items>
                <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                    <Image Url="~/Images/shared/edit_add.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                    <Image Url="~/Images/shared/edit.png" UrlDisabled="~/Images/shared/edit_disable.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                    <Image Url="~/Images/shared/editdelete.png" UrlDisabled="~/Images/shared/editdelete_disable.png">
                    </Image>
                </dx:MenuItem>
            </Items>
        </dx:ASPxMenu>

        <dx:ASPxGridView ID="grdServise" ClientInstanceName="grdServise" runat="server" AutoGenerateColumns="False" DataSourceID="ds_Services" KeyFieldName="CODE" OnRowInserting="grdServise_RowInserting">
            <Columns>
                <dx:GridViewDataTextColumn Caption="Код" FieldName="CODE" ReadOnly="True" VisibleIndex="0">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="Наименование" FieldName="NAME" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataSpinEditColumn Caption="Тариф" FieldName="TARIF" VisibleIndex="2">
                    <PropertiesSpinEdit DisplayFormatString="g">
                    </PropertiesSpinEdit>
                </dx:GridViewDataSpinEditColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" ConfirmDelete="True" EnableCustomizationWindow="true" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
            <SettingsPager AlwaysShowPager="True">
                <PageSizeItemSettings Visible="True">
                </PageSizeItemSettings>
            </SettingsPager>
        </dx:ASPxGridView>
        <asp:EntityDataSource ID="ds_Services" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="SERVICES" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
        </asp:EntityDataSource>
    </div>
</asp:Content>

